import Router from "@koa/router";
import {
  getCodeSnippets,
  getCodeSnippetById,
  createCodeSnippet,
  updateCodeSnippet,
  deleteCodeSnippet,
} from "../controller/code.js";

const router = new Router({
  prefix: "/api/snippets",
});

// 获取代码片段列表
router.get("/", getCodeSnippets);

// 获取单个代码片段
router.get("/:id", getCodeSnippetById);

// 创建新代码片段
router.post("/", createCodeSnippet);

// 更新代码片段
router.put("/:id", updateCodeSnippet);

// 删除代码片段
router.delete("/:id", deleteCodeSnippet);

export default router;